#pragma once

#include "../Math/vec2.h"

class DGame;
class DAnimation;
typedef std::map<std::string, boost::shared_ptr<DAnimation> > AnimationMap;

class DGraphicsParams
{
public:
    DGraphicsParams();

    void setRedChannel(int red);
    void setGreenChannel(int green);
    void setBlueChannel(int blue);
    void setAlphaChannel(int alpha);
    void setColorChannels(int red, int green, int blue, int alpha);

    void setFlippedX(bool flipped);
    void setFlippedY(bool flipped);
    void setFlipped(bool x, bool y);

    int redChannel() const;
    int greenChannel() const;
    int blueChannel() const;
    int alphaChannel() const;

    bool isFlippedX() const;
    bool isFlippedY() const;
private:
    int m_redChannel;
    int m_greenChannel;
    int m_blueChannel;
    int m_alphaChannel;

    bool m_bFlippedX;
    bool m_bFlippedY;
};

class DIActor
{
public:
	virtual ~DIActor(void);

	boost::shared_ptr<DAnimation> currentAnimation();
	void addAnimation(const std::string& name, boost::shared_ptr<DAnimation> anim);
	void setCurrentAnimation(const std::string& name);

    const DGraphicsParams& graphicsParams() const;
    DGraphicsParams& graphicsParams();

    const vec2& pos();
    void setPos(const vec2& pos);

    const vec2& scale();
    void setScale(const vec2& scale);

	virtual void update(float dt) = 0;

    boost::shared_ptr<DGame> game() const;

	virtual std::map<std::string, std::string> animationList() const = 0;

    virtual void initWeapons();
protected:
	void updateMoving(float dt);
	DIActor(boost::shared_ptr<DGame> game);

	AnimationMap m_anims;
	boost::weak_ptr<DAnimation> m_currentAnim;

    DGraphicsParams m_graphicsParams;
    
    vec2 m_pos;
	vec2 m_vel;
	vec2 m_acc;

    vec2 m_scale;

    boost::weak_ptr<DGame> m_game;
};